package servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by Yonggao.Dong on 15/9/14.
 */
public class Sample extends HttpServlet {
    first.Sample sample ;
    @Override
    public void init() throws ServletException {
        sample = new first.Sample();
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String input = req.getParameter("input");
        int value = Integer.valueOf(input);
        boolean even = sample.vefiryEven(value);
        String out = "";
        if (!even)
            out+="不";
        out+="是一个偶数";

        resp.setContentType("text/html;charset=UTF-8");

        resp.getWriter().println(out);

        resp.getWriter().close();

    }
}
